package com.zijidelu.luframework.plugins.tomlock.core.data;

import lombok.Builder;
import lombok.Data;

import java.lang.reflect.Parameter;
import java.util.List;
import java.util.stream.IntStream;

/**
 * 方法参数。
 *
 * @author ZIJIDELU
 * @datetime 2025/4/13 19:39
 */
@Builder
@Data
public class MethodParams {
    private String paramName;
    private Object paramValue;

    public static List<MethodParams> from(final Parameter[] parameters,
                                          final Object[] args) {

        return IntStream.range(0, parameters.length)
                .mapToObj(i -> MethodParams.builder().paramName(parameters[i].getName()).paramValue(args[i]).build())
                .toList();
    }
}
